package com.zhouchb.blog.Controller;

import com.zhouchb.blog.bean.Blog;
import com.zhouchb.blog.service.BlogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.Map;

/**
 * @Author Zhouchb
 * @Create 2021-09-2021/9/15 :15:40
 * @Description
 */
@Slf4j
@Controller
public class ArchivesShowController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/archives")
    public String showArchives(Model model){
        Map<String, List<Blog>> stringListMap = blogService.archivesBlog();
        int blogTotal = blogService.blogTotalService();
        model.addAttribute("stringListMap",stringListMap);
        model.addAttribute("blogTotal",blogTotal);
        return "archives";
    }
}
